﻿using System;

namespace Spencen.Mobile.Markup
{
    public abstract class XamlNode
    {
        private object _dataContext;

        public XamlNode( XamlNode parent, string name, string @namespace )
        {
            Parent = parent;
            Name = name;
            Namespace = @namespace;
        }

        public string Name { get; private set; }
        public string Namespace { get; private set; }
        public XamlNode Parent { get; private set; }
        public abstract string MemberName { get; }

        public object DataContext
        {
            get { return _dataContext ?? ( Parent == null ? null : Parent.DataContext ); }
            set { _dataContext = value; }
        }

    }
}
